package com.example.xlzx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.example.xlzx.entity.Post;
import com.example.xlzx.dao.PostMapper;
import com.example.xlzx.service.IPostService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 帖子表 服务实现类
 * </p>
 *
 * @author 1
 * @since 2025-03-07
 */
@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IPostService {

    @Override
    public Boolean updatePostInfo(Post post) {
        return lambdaUpdate()
                .eq(Post::getId,post.getId())
                .set(StringUtils.isNotEmpty(post.getTitle()),Post::getTitle,post.getTitle())
                .set(StringUtils.isNotEmpty(post.getContent()),Post::getContent,post.getContent())
                .update();
    }
}
